package com.smart.car.finance.service.impl;


import com.alibaba.fastjson.JSONObject;
import com.smart.car.finance.entity.FinanceBill;
import com.smart.car.finance.entity.FinanceBillExample;
import com.smart.car.finance.mapper.FinanceBillMapper;
import com.smart.car.finance.service.FinanceBillService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class FinanceBillServiceImpl implements FinanceBillService {

	@Resource
	private FinanceBillMapper billMapper;

	@Override
	public int create(String json) {
		FinanceBill bill = JSONObject.parseObject(json, FinanceBill.class);
		log.info("分析帐单数据，存入支付记录表中>>>>>>>>>>>>>>>>> " +json);
		return billMapper.insertSelective(bill);
	}

	@Override
	public List<FinanceBill> list() {
		FinanceBillExample example = new FinanceBillExample();
		List<FinanceBill> infoList = billMapper.selectByExample(example);
		return infoList;
	}

//	@Autowired
//	private MessageInfoMapper messageMapper;
//
//	@Override
//	public int sendNotice(String json) {
//		//log.info("message data = " + json);
//		//Message message = JSONObject.parseObject(json, Message.class);
//		return messageMapper.insertSelective(null);
//	}
//
}
